#指定目标系统
INCLUDE(CMakeForceCompiler)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR riscv64)

# 指定 RISC-V 交叉编译器
# set(CMAKE_C_COMPILER /usr/bin/riscv64-linux-gnu-gcc)
# set(CMAKE_CXX_COMPILER /usr/bin/riscv64-linux-gnu-g++)


# 指定目标系统的 sysroot
set(CMAKE_SYSROOT $ENV{SYSROOT})

# 设置 CMake 依赖查找路径
set(CMAKE_FIND_ROOT_PATH $ENV{ROS2_INSTALL_PATH} ${CMAKE_SYSROOT} ${CMAKE_CURRENT_LIST_DIR}/../install ${CMAKE_CURRENT_LIST_DIR}/../build)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) #
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # BOTH
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # BOTH

set(CMAKE_CROSSCOMPILING_EMULATOR qemu-riscv64-static)

# 指定 Python 共享库 ABI
#set(PYTHON_SOABI $ENV{PYTHON_SOABI})

# 处理 Qt5 moc
#if(NOT TARGET Qt5::moc)
#  set(QT_MOC_EXECUTABLE /usr/bin/moc)
#  add_executable(Qt5::moc IMPORTED)
#  set_property(TARGET Qt5::moc PROPERTY IMPORTED_LOCATION ${QT_MOC_EXECUTABLE})
#endif()

# 假设目标系统支持 pthread，避免 TRY_RUN 失败
set(THREADS_PTHREAD_ARG "0"
  CACHE STRING "Result from TRY_RUN" FORCE)

